#include <stdio.h>

int main() {
    int a,b,c,d,n;
    printf("plz enter a number\n");
    scanf("%d",&n);
    for(a=0;a<=n;a++){
        for(b=0;b<=n;b++) {
            for (c = 0; c <= n; c++) {
                for (d = 0; d <= n; d++) {
                    if (n == a * a + b * b + c * c + d * d) {
                        printf("%d^2+%d^2+%d^2+%d^2=%d\n", a, b, c, d, n);
                    }
                }
            }
        }
    }
    return 0;
}
